<template>
  <a-card :bordered="false" style="display: flex;justify-content:center;height: 100%" >
    <div style="margin:100px auto;">
      <img src="~@/assets/welcome.png" class="logo" alt="logo">
    </div>
    <h2>{{ this.info.success ? this.info.data:this.info.message }}</h2>
    <a-popconfirm placement="topRight" title="是否退出？" @confirm="() => logout()">
      <a>退出</a>
    </a-popconfirm>
    <a style="padding-left: 10px;" size="large" @click.stop.prevent="see">查看</a>
  </a-card>
</template>

<script>
import { getLoginUserM } from '@/api/modular/main/loginM'
import { mapActions } from 'vuex'

export default {
    name: 'DetailForm',
    components: {
    },
    data () {
      return {
        info: {}
      }
    },
    created () {
      this.getInfo()
    },
    methods: {
      ...mapActions(['Logout']),
      // 初始化方法
      getInfo () {
        getLoginUserM({}).then((res) => {
          console.info('--------------------------------')
          if (res.success) {
            this.info = res
          } else {
            this.$router.push({ name: 'login' })
          }
        })
      },
      see () {
        getLoginUserM({}).then((res) => {
          this.info = res
        })
      },
      logout () {
        this.Logout({}).then(() => {
          setTimeout(() => {
            this.$router.push({ name: 'login' })
          }, 16)
        })
      }
    }
  }
</script>

<style lang="less" scoped>

</style>
